def write_file(file, mode, s):
    f = open('data/' + file, mode, encoding='utf-8')
    f.write(s)
    f.close()


write_file('aaa.txt', 'w', "你好，世界")
write_file('aaa.txt', 'w', 'hello, world')
write_file('bbb.txt', 'a', '伟大的中国梦')


def write_file_list(file, mode, items):
    f = open('data/' + file, mode, encoding='utf-8')
    f.writelines(items)
    f.close()


items = ['姓名\t', '年龄\t', '成绩\n', '张三\t', '20\t', '90\n']
write_file_list('ccc.txt', 'a', items)
